#import "LoginPromptView.h"

@implementation LoginPromptView

+ (instancetype)promptView {
    LoginPromptView *view = [[LoginPromptView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 60)];
    view.backgroundColor = [UIColor colorWithRed:0.92 green:0.23 blue:0.19 alpha:1.0]; // 红色背景，可按需调整
    
    UILabel *promptLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, view.bounds.size.width - 100, view.bounds.size.height)];
    promptLabel.text = @"您尚未登录，部分功能无法使用";
    promptLabel.textColor = [UIColor whiteColor];
    promptLabel.font = [UIFont systemFontOfSize:16];
    [view addSubview:promptLabel];
    
    UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeSystem];
    loginButton.frame = CGRectMake(view.bounds.size.width - 80, 0, 80, view.bounds.size.height);
    [loginButton setTitle:@"登录" forState:UIControlStateNormal];
    [loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [loginButton addTarget:self action:@selector(loginButtonTapped) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:loginButton];
    
    view.loginButton = loginButton;
    
    return view;
}

- (void)loginButtonTapped {
    NSLog(@"登录按钮被点击");
    // 这里可以实现跳转到登录页面的逻辑
}

@end
